package product.api.service;

import common.server.entity.InsideRequestMessage;
import common.server.entity.InsideResponseMessage;
import common.server.entity.OutsideRequestMessage;
import common.server.entity.OutsideResponseMessage;
import common.server.feign.FeignClientDefaultConfiguration;
import feign.Headers;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.ResponseBody;
import product.api.entity.param.ProductParam;
import product.api.entity.result.ProductPojo;
import product.api.fallback.ProductServiceFallbackFactory;

import java.util.List;

/**
 * @Title: IProductServer
 * @ProjectName com-bigwavn-group
 * @Description: 商品模块对外API
 * @author: wangweitao 1749343503@qq.com
 * @date: 2019/5/28 16:38
 * @version: V1.0.0
 */
@FeignClient(name = "com-bigwavn-product-server", fallbackFactory = ProductServiceFallbackFactory.class,configuration = FeignClientDefaultConfiguration.class)
public interface IProductService {

    /**
     * @Description: 获取商品列表，条件查询（管理平台）
     * @param: [trace, param]
     * @return: common.server.entity.InsideResponseMessage
     * @throws
     * @author: wangweitao
     * @date: 2019/5/28 17:08
     */
    @Headers("Content-Type: application/json")
    @ResponseBody
    @PostMapping(path = "product/IProductService/list", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    InsideResponseMessage<List<ProductPojo>> getProductList(@RequestHeader(name = "Trace") String trace, InsideRequestMessage<ProductParam> req);

    /**
     * @Description: 获取商品数量，条件查询（管理平台）
     * @param: [trace, param]
     * @return: common.server.entity.OutsideResponseMessage
     * @throws
     * @author: wangweitao
     * @date: 2019/5/28 17:08
     */
    @Headers("Content-Type: application/json")
    @ResponseBody
    @PostMapping(path = "product/IProductService/count", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    InsideResponseMessage<ProductPojo> getProductCount(@RequestHeader(name = "Trace") String trace, @RequestBody InsideRequestMessage<ProductParam> req);

    /**
     * @Description: 获取商品列表（管理平台）
     * @param: [trace, param]
     * @return: common.server.entity.OutsideResponseMessage
     * @throws
     * @author: wangweitao
     * @date: 2019/5/28 17:08
     */
    @Headers("Content-Type: application/json")
    @RequestLine("POST /boss-server/flow")
    @ResponseBody
    @PostMapping(path = "product/IProductService/list", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    OutsideResponseMessage<ProductPojo> getProductLists(@RequestHeader(name = "Trace") String trace, @RequestBody OutsideRequestMessage<ProductParam> req);


}
